package com.aw.baselib.base

import com.google.gson.Gson
import okhttp3.MediaType
import okhttp3.RequestBody

/**
 * @author : hzw
 * @date : 2020/3/20
 */
open class AwBaseRequest {
    companion object {
        @JvmStatic
        protected fun getBody(`object`: Any?): RequestBody {
            return RequestBody.create(
                MediaType.parse("application/json; charset=utf-8"),
                Gson().toJson(`object`)
            )
        }

        protected fun getBodyText(`object`: String?): RequestBody {
            return RequestBody.create(MediaType.parse("text/plain"), `object`)
        }
    }
}